package src.main.java.org.properties;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.Properties;

/*
* 将users.txt中的李方年龄改为18
* */
public class Test3 {
    public static void main(String[] args) throws Exception {
        Properties properties = new Properties();
        properties.load(new FileReader("E:\\JavaLearn\\javaCode\\src\\users.txt"));

        if(properties.containsKey("李方")){
            properties.setProperty("李方","18");
        }
        properties.store(new FileWriter("E:\\JavaLearn\\javaCode\\src\\users.txt"),
                "update success");
    }
}
